<template>
  <div>
    <div class="title">
      <el-row>
        <el-col :span="1" style="width: 50px;">
          <span style="color:#757575;">位置 :</span>
        </el-col>
        <el-col :span="20">
          <span @click="tableshow" class="hand" :class="{'textactive' : !secondshow}">{{title}}</span>
          <span v-if="secondshow" :class="{'textactive' : secondshow}">> {{secondtitle}}</span>
        </el-col>
      </el-row>
    </div>
    <div v-show="!addShow">
      <div class="top workrecord">
        <el-row>
          <el-col style="width: 320px;height: 360px;border: 2px solid #ececec;">
            <el-calendar v-model="data1">
              <template slot="dateCell" slot-scope="{date, data}">
                <div style="width: 100%;height: 100%;">
                  <p>{{ data.day.split('-').slice(2).join('-') }}</p>
                </div>
              </template>
            </el-calendar>
          </el-col>
          <el-col class="secondbox">
            <div
              style="border:2px solid #ececec;height:336px;padding:20px 15px 0px 0px;margin-left:20px;"
            >
              <i
                class="iconfont icon-livesvg06"
                style="color:#fa8b32;display:inline-block;width:20px;height:16px;margin-left: 15px;"
              ></i>
              <span style="color:#323232;font-size:14px;margin-left:10px;font-weight:700">下载情况</span>
              <el-button
                class="add"
                round
                size="small"
                style="float:right"
                @click="addClick"
                v-if="btndis"
              >新增</el-button>
              <div style="padding-top:25px;padding-left:34px;height: 251.25px;">
                <el-scrollbar style="height: 100%;">
                  <div class="timeLine">
                    <el-row v-if="activities.list" style="width: 45%;">
                      <el-col
                        v-for="(item,index) in activities.list"
                        :key="index"
                        v-if="activities.list.length !== 0"
                      >
                        <el-col style="width: 6%;">
                          <el-row type="flex" justify="center">
                            <el-col style="width: 14px;">
                              <div
                                style="width: 12px;height: 12px;border-radius: 50%;border: 1px solid #1864c7;background-color:#4979fd;"
                              >
                                <div
                                  style="width: 6px;height: 6px;border-radius: 50%;background-color: #fff;margin: 0 auto;margin-top: 3px;"
                                ></div>
                              </div>
                              <div
                                style="width: 5px;height: 35px;background-color: #ececec;margin: 0 auto;"
                                v-if="index !== activities.list.length - 1"
                              ></div>
                            </el-col>
                          </el-row>
                        </el-col>
                        <el-col style="width: 90%;">
                          <p style="font-size: 14px;margin-left: 10px;">{{item}}</p>
                        </el-col>
                      </el-col>
                      <div v-if="activities.list.length == 0">
                        <div style="text-align: center;">
                          <img src="../../../static/image/leida.png" alt style="width: 350px;" />
                          <p style="color: #b6b6b6;margin-top: 30px;">暂无数据!</p>
                        </div>
                      </div>
                    </el-row>
                    <div style="width: 55%;text-align: center;">
                      <div class="bigBox" style="margin: 0 auto;">
                        <div class="inside">{{activities.num}}</div>
                      </div>
                      <p class="totalText">下载简历总数</p>
                    </div>
                  </div>
                </el-scrollbar>
              </div>
            </div>
          </el-col>
          <!-- <el-col :xl="9">
            <div style="border:2px solid #ececec;height:346px;padding:10px 15px 0px;">
              <i
                class="iconfont icon-c15_show"
                style="color:#25c6d8;display:inline-block;width:20px;height:16px;"
              ></i>
              <span style="color:#323232;font-size:14px;margin-left:10px;font-weight:700">完成情况</span>
              <div>
                <el-row>
                  <el-col style="width:45%;">
                    <div id="container" style="height:300px;"></div>
                  </el-col>
                  <el-col style="width:45%;height: 300px;position: relative;">
                    <div style="height: 100%;" v-if="completionlist.percentage !== 1">
                      <div id="chart" style="width: 300px;height:300px;margin: 0 auto;"></div>
                    </div>
                    <el-col v-if="completionlist.percentage == 1">
                      <div
                        style="width: 150px;height: 150px;background-color:#5fb3f7;border-radius: 50%;text-align: center;display: inline-block;  position: absolute;left: 50%; top: 40%;margin-left: -75px;margin-top: -100px;color: #fff; "
                      >
                        <i class="iconfont icon-dagou" style="line-height: 110px;font-size: 40px;"></i>
                        <p style="width: 100%;height: 20px;margin-top: -20px;">任务完成</p>
                      </div>
                    </el-col>
                    <el-col v-if="completionlist.percentage == 1">
                      <el-button
                        type="danger"
                        round
                        style="position: absolute;bottom: 50px;left: 50%;width: 166px;height: 36px;margin-left: -83px;"
                        @click="logout"
                        v-if="btndis"
                      >关闭系统</el-button>
                    </el-col>
                  </el-col>
                </el-row>
                <div></div>
              </div>
            </div>
          </el-col> -->
        </el-row>
      </div>
      <div class="center">
        <i class="iconfont icon-plane" style="color:#00b6d3"></i>
        <span style="color:#343434;font-size:14px;font-weight:700;margin-left:10px;">上传记录</span>
        <el-table ref="singleTable" highlight-current-row :data="tableData" class="tableT">
          <!-- <el-table-column width="100" prop="type" label="职位情况"></el-table-column> -->
          <el-table-column width="100" prop="customer_name" label="推送客户"></el-table-column>
          <el-table-column width="100" prop="origin" label="简历来源"></el-table-column>
          <el-table-column width="50" prop="sex" label="性别"></el-table-column>
          <el-table-column width="100" prop="name" label="姓名"></el-table-column>
          <el-table-column width="120" prop="phone" label="联系方式"></el-table-column>
          <el-table-column width="160" prop="post_name" label="职位"></el-table-column>
          <el-table-column width="50" prop="post_level" label="级别"></el-table-column>
          <el-table-column width="50" prop="status" label="状态"></el-table-column>
          <el-table-column width="100" label="期望薪资">
            <template
              slot-scope="scope"
            >{{scope.row.expect_salary}}k*{{scope.row.expect_salary_num}}</template>
          </el-table-column>
          <el-table-column width="100" prop="entry_time" label="到岗时间"></el-table-column>
          <el-table-column prop="initial_evaluation" label="初步评价"></el-table-column>
        </el-table>
        <div class="pager">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="pagehandleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[5,10,15]"
            :page-size="pagesize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="totalcount"
          ></el-pagination>
        </div>
      </div>
      <div class="bottom">
        <i class="iconfont icon-xiazai" style="color:#9390df"></i>
        <span
          style="color:#323232;font-size:14px;margin-left:10px;font-weight:700;margin-bottom:10px;"
        >下载简历</span>
        <el-row type="flex" justify="center">
          <el-col style="padding-top: 10px;">
            <el-col class="data" v-if="data.length !== 0" v-for="item in data" :key="item.id">
              <a
                :href="item.group+'/'+item.fileAddress"
                style="font-size: 16px;color:#57adfb;line-height:50px;text-decoration: none;"
                target="_blank"
              >{{item.name}}</a>
              <p style="color:#767676;font-size:14px;">未推送原因：{{item.reason}}</p>
            </el-col>
            <div v-if="data.length == 0">
              <div style="text-align: center;">
                <img src="../../../static/image/leida.png" alt style="width: 350px;" />
                <p style="color: #b6b6b6;margin-top: 30px;">暂无数据!</p>
              </div>
            </div>
          </el-col>
        </el-row>
      </div>

      <div class="center">
        <el-col>
          <div class="tabletitle" style="float: left;margin-left: -10px;">
            <span style="color:#343434;font-size:14px;font-weight:700;margin-left:10px;">预约面试情况</span>
          </div>
          <div class="right1" style="float: right" v-if="btndis">
            <el-button class="add" size="small" round @click="interviewadd">新增</el-button>
            <el-button class="edit" size="small" round @click="interviewedit">修改</el-button>
            <el-button class="delete" size="small" round @click="interviewdelete">删除</el-button>
          </div>
        </el-col>

        <el-table
          ref="singleTable1"
          highlight-current-row
          :data="tableData1"
          class="tableT"
          @current-change="handleCurrentChange"
        >
          <el-table-column width="100" prop="push" label="推送"></el-table-column>
          <el-table-column width="100" prop="customerName" label="推送客户"></el-table-column>
          <el-table-column width="100" prop="origin" label="简历来源"></el-table-column>
          <el-table-column width="50" prop="sex" label="性别"></el-table-column>
          <el-table-column width="100" prop="name" label="姓名"></el-table-column>
          <el-table-column width="120" prop="phone" label="联系方式"></el-table-column>
          <el-table-column width="120" prop="email" label="邮箱"></el-table-column>
          <el-table-column width="160" prop="interviewPost" label="面试职位"></el-table-column>
          <el-table-column width="50" prop="postLevel" label="级别"></el-table-column>
          <el-table-column width="50" prop="status" label="状态"></el-table-column>
          <el-table-column width="100" label="反馈时间">
            <template slot-scope="scope">
              <span>{{scope.row.feedbacktime | converTime("YYYY-MM-DD") }}</span>
            </template>
          </el-table-column>
          <el-table-column label="预约面试时间">
            <template slot-scope="scope">
              <span>{{scope.row.interviewtime | converTime("YYYY-MM-DD") }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="remarks" label="备注"></el-table-column>
        </el-table>
        <div class="pager">
          <el-pagination
            @size-change="handleSizeChange1"
            @current-change="pagehandleCurrentChange1"
            :current-page="currentPage1"
            :page-sizes="[5,10,15]"
            :page-size="pagesize1"
            layout="total, sizes, prev, pager, next, jumper"
            :total="totalcount1"
          ></el-pagination>
        </div>
      </div>

      <div class="center">
        <el-col>
          <div class="tabletitle" style="float: left;margin-left: -10px;">
            <span style="color:#343434;font-size:14px;font-weight:700;margin-left:10px;">入职情况</span>
          </div>
          <div class="right1" style="float: right" v-if="btndis">
            <el-button class="add" size="small" round @click="entryadd">新增</el-button>
            <el-button class="edit" size="small" round @click="entryedit">修改</el-button>
            <el-button class="delete" size="small" round @click="entrydelete">删除</el-button>
          </div>
        </el-col>

        <el-table
          ref="singleTable2"
          highlight-current-row
          :data="tableData2"
          class="tableT"
          @current-change="handleCurrentChange1"
        >
          <el-table-column width="100" prop="push" label="推送"></el-table-column>
          <el-table-column width="100" prop="customerName" label="推送客户"></el-table-column>
          <el-table-column width="100" prop="origin" label="简历来源"></el-table-column>
          <el-table-column width="50" prop="sex" label="性别"></el-table-column>
          <el-table-column width="100" prop="name" label="姓名"></el-table-column>
          <el-table-column width="120" prop="phone" label="联系方式"></el-table-column>
          <el-table-column width="120" prop="email" label="邮箱"></el-table-column>
          <el-table-column width="160" prop="interviewPost" label="面试职位"></el-table-column>
          <el-table-column  prop="postLevel" label="级别"></el-table-column>
          <el-table-column width="100" prop="entryStatus" label="入职情况"></el-table-column>
          <el-table-column   label="入职时间">
            <template slot-scope="scope">
              <span>{{scope.row.entryTime | converTime("YYYY-MM-DD") }}</span>
            </template>
          </el-table-column>
          <el-table-column  label="进场时间">
            <template slot-scope="scope">
              <span>{{scope.row.reporyTime | converTime("YYYY-MM-DD") }}</span>
            </template>
          </el-table-column>
        </el-table>
        <div class="pager">
          <el-pagination
            @size-change="handleSizeChange2"
            @current-change="pagehandleCurrentChange2"
            :current-page="currentPage2"
            :page-sizes="[5,10,15]"
            :page-size="pagesize2"
            layout="total, sizes, prev, pager, next, jumper"
            :total="totalcount2"
          ></el-pagination>
        </div>
      </div>

      <div style="margin-top:10px;">
        <el-col :span="23" style="height:100%;background:#fff;padding-top:10px;">
          <div class="tabletitle" style="margin-left: 10px;margin-bottom:15px;">
            <span style="color:#343434;font-size:14px;font-weight:700;margin-left:10px;">备注</span>
          </div>
          <el-col :span="12" style="margin-left: 18px;margin-bottom:15px;">
            <el-input
              v-model.trim="remarks"
              :disabled="!btndis"
              style="width: 100%;"
              type="textarea"
              placeholder="请输入备注"
              :autosize="{ minRows: 4}"
            ></el-input>
          </el-col>
          <el-col style="margin-left: 18px;margin-bottom:15px;">
            <el-button class="save" :disabled="savedis" @click="updatetodaywork()" v-if="btndis">保存</el-button>
          </el-col>
        </el-col>
      </div>

      <el-dialog
        title="新增"
        :visible.sync="dialogVisible"
        width="415px"
        :before-close="dialogClose"
        class="addP contentR workrecord1"
      >
        <div style="height: 250px;">
          <el-scrollbar style="height: 100%;width: 330px;">
            <el-form :model="addform" ref="addform" label-position="top">
              <el-col v-for="(item,index) in addform.data" :key="index">
                <el-form-item
                  :prop="'data.' + index + '.websiteName'"
                  :rules="{
                required: true, message: '招聘网站不能为空', trigger: 'change'
                }"
                >
                  <el-col>
                    <span style="color:#333;">
                      <span style="color:#F56C6C;">*</span> 招聘网站
                    </span>
                    <i
                      class="el-icon-circle-plus"
                      style="color:#1198ff;font-size: 12px;cursor: pointer;"
                      v-if="index == 0"
                      @click="add()"
                    ></i>
                    <span
                      style="color:#1198ff;font-size: 14px;cursor: pointer;"
                      v-if="index == 0"
                      @click="add()"
                    >添加</span>

                    <i
                      class="el-icon-circle-close"
                      style="color:#f41f1e;font-size: 12px;cursor: pointer;"
                      v-if="index !== 0"
                      @click="delete1(index)"
                    ></i>
                    <span
                      style="color:#f41f1e;font-size: 14px;cursor: pointer;"
                      v-if="index !== 0"
                      @click="delete1(index,item.websiteName)"
                    >删除</span>
                  </el-col>
                  <el-select
                    v-model.trim="item.websiteName"
                    placeholder="请选择招聘网站"
                    style="width: 274px"
                    @change="selweb(index,item.websiteName)"
                  >
                    <el-option
                      v-for="(item1,index1) in websitelist"
                      :key="index1"
                      :label="item1"
                      :value="item1"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item
                  label="简历下载数量"
                  :prop="'data.' + index + '.downloadNum'"
                  :rules="numRules"
                >
                  <el-input
                    @blur="judge1(index,item.downloadNum)"
                    v-model.trim="item.downloadNum"
                    style="width: 274px"
                  ></el-input>
                </el-form-item>
                <el-form-item
                  label="电话沟通数量"
                  :prop="'data.' + index + '.callNum'"
                  :rules="telnumRules"
                >
                  <el-input
                    v-model.trim="item.callNum"
                    @blur="judge(index,item.callNum)"
                    style="width: 274px"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-form>
          </el-scrollbar>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button class="sure" round :disabled="adddis" @click="addConfirm('addform')">确 定</el-button>
          <el-button round @click="dialogClose" class="cancel">取 消</el-button>
        </span>
      </el-dialog>

      <el-dialog
        title="错误"
        :visible.sync="errordialogVisible"
        width="30%"
        :before-close="handleClose"
        class="deletedialog"
      >
        <div style="text-align: center">
          <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
            <span style="font-size: 16px;color: #333;margin-left: 12px;">选择日期超过当前日期</span>
          </i>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button class="sure" round @click="handleClose">确 定</el-button>
          <el-button round @click="handleClose" class="cancel">取 消</el-button>
        </span>
      </el-dialog>
    </div>

    <el-dialog
      title="错误"
      :visible.sync="errordialogVisible1"
      width="30%"
      :before-close="handleClose1"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">尚未选择预约面试情况</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" round @click="handleClose1">确 定</el-button>
        <el-button round @click="handleClose1" class="cancel">取 消</el-button>
      </span>
    </el-dialog>

    <el-dialog
      title="错误"
      :visible.sync="errordialogVisible2"
      width="30%"
      :before-close="handleClose2"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">尚未选择入职情况</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" round @click="handleClose2">确 定</el-button>
        <el-button round @click="handleClose2" class="cancel">取 消</el-button>
      </span>
    </el-dialog>

    <el-dialog
      title="删除入职情况"
      :visible.sync="deletedialogVisible1"
      width="30%"
      :before-close="deleteClose1"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">确定删除该入职情况吗？</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" :disabled="deletedis1" round @click="deletesend1">确 定</el-button>
        <el-button round @click="deleteClose1" class="cancel">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="删除预约面试情况"
      :visible.sync="deletedialogVisible"
      width="30%"
      :before-close="deleteClose"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">确定删除该预约面试情况吗？</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" :disabled="deletedis" round @click="deletesend">确 定</el-button>
        <el-button round @click="deleteClose" class="cancel">取 消</el-button>
      </span>
    </el-dialog>

    <div v-if="type == 1">
      <interview-add
        ref="interviewAdd"
        :user-name="username"
        @postSucess="initMsg"
        @hide="hideShow"
        v-show="addShow"
      ></interview-add>
    </div>

    <div v-if="type == 2">
      <interview-edit
        ref="interviewEdit"
        @postSucess1="initMsg1"
        @hide="hideShow"
        v-show="addShow"
        :current-data1="currentRow"
      ></interview-edit>
    </div>
    <div v-if="type == 3">
      <entry-add
        ref="entryAdd"
        :user-name="username"
        @postSucess2="initMsg2"
        @hide="hideShow"
        v-show="addShow"
      ></entry-add>
    </div>
    <div v-if="type == 4">
      <entry-edit
        ref="entryEdit"
        @postSucess3="initMsg3"
        @hide="hideShow"
        v-show="addShow"
        :current-data2="currentRow1"
      ></entry-edit>
    </div>
  </div>
</template>

<script>
import moment from "moment";
import axios from "axios";
import "echarts-liquidfill/src/liquidFill";
import Highcharts from "highcharts";
import tagsView from "../../store/modules/tagsView";
import interviewAdd from "./interviewadd";
import interviewEdit from "./interviewedit";
import entryAdd from "./entryadd";
import entryEdit from "./entryedit";
export default {
  name: "workrecord1",
  data() {
    var checkdownloadnum = (rule, value, callback) => {
      var re = /^\d+$/;
      setTimeout(() => {
        if (!re.test(value)) {
          callback(new Error("请输入正整数"));
        } else {
          callback();
        }
      }, 1000);
    };
    var checktelnum = (rule, value, callback) => {
      var re = /^\d+$/;
      setTimeout(() => {
        if (!re.test(value)) {
          callback(new Error("请输入正整数"));
        } else {
          callback();
        }
      }, 1000);
    };
    return {
      date: moment(new Date()).format("YYYY-MM-DD"),
      data1: moment(new Date()).format("YYYY-MM-DD"),
      title: "工作记录（专员）",
      activities: [],
      total: 20,
      tableData: [],
      currentPage: 1,
      pagesize: 15,
      totalcount: null,
      tableData1: [],
      currentPage1: 1,
      pagesize1: 15,
      totalcount1: null,
      currentRow: null,
      tableData2: [],
      currentPage2: 1,
      pagesize2: 15,
      totalcount2: null,
      currentRow1: null,
      numRules: [
        { required: true, message: "简历下载不能为空", trigger: "blur" },
        { validator: checkdownloadnum, trigger: "blur" }
      ],
      telnumRules: [
        { required: true, message: "电话沟通数量不能为空", trigger: "blur" },
        { validator: checktelnum, trigger: "blur" }
      ],
      data: [],
      btndis: true,
      dialogVisible: false,
      num: 1,
      addform: {
        data: [
          {
            websiteName: "",
            downloadNum: "",
            callNum: ""
          }
        ]
      },
      websitelist: [],
      adddis: false,
      completionlist: {},
      errordialogVisible: false,
      repeaterror: false,
      repeat1: null,
      numerror: false,
      numerror1: false,
      num1: null,
      num2: null,
      savedis: false,
      btndis: true,
      inputdis: false,
      type: null,
      addShow: false,
      secondshow: false,
      remarks: "",
      id: "",
      username: "",
      errordialogVisible1: false,
      errordialogVisible2: false,
      deletedis: false,
      deletedialogVisible: false,
      deletedialogVisible1: false,
      deletedis1: false
    };
  },
  created() {
    this.selectdownloadinfo();
    this.selectwebsite();
    this.selectuploadrecord();
    this.selectdownloadresume();
    // this.selectcompletion();

    axios.post(this.url + "/user/iflogin").then(res => {
      this.unlogin(res.data.code);
      if (res.data.code == 200) {
        this.username = res.data.data;
        this.getReamrk();
        this.getinterviewdata();
        this.getentrydata();
      }
    });
  },
  mounted() {},
  methods: {
    handleCurrentChange(val) {
      this.currentRow = val;
    },
    handleCurrentChange1(val) {
      this.currentRow1 = val; 
    },
    tableshow() {
      this.addShow = false;
      this.secondshow = false;
      this.secondtitle = "";
      this.type = null;
    },
    interviewadd() {
      this.addShow = !this.addShow;
      this.secondtitle = "新增预约面试情况";
      this.secondshow = true;
      this.type = 1;
    },
    interviewedit() {
      if (this.currentRow == null) {
        this.errordialogVisible1 = true;
        document.documentElement.style.overflow = "hidden";
      } else {
        this.addShow = !this.addShow;
        this.secondtitle = "修改预约面试情况";
        this.secondshow = true;
        this.type = 2;
      }
    },
    //删除预约面试情况
    interviewdelete() {
      if (this.currentRow == null) {
        this.errordialogVisible1 = true;
        document.documentElement.style.overflow = "hidden";
      } else {
        this.deletedialogVisible = true;
        document.documentElement.style.overflow = "hidden";
      }
    },
    deleteClose() {
      this.deletedialogVisible = false;
      document.documentElement.style.overflow = "auto";
    },
    deletesend() {
      this.deletedis = true;
      axios
        .post(this.url + "/workrecord/deledata", {
          id: this.currentRow.id
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.deletedis = false;
            this.deletedialogVisible = false;
            document.documentElement.style.overflow = "auto";
            this.currentPage1 = 1;
            axios
              .post(this.url + "/workrecord/getinterviewdata", {
                username: this.username,
                time: this.date,
                pageNum: this.currentPage1,
                pageSize: this.pagesize1
              })
              .then(res => {
                this.unlogin(res.data.code);
                if (res.data.code == 200) {
                  this.tableData1 = res.data.data.list;
                  this.totalcount1 = res.data.data.total;
                }
              });
          }
        });
    },
    //删除入职情况
    entrydelete() {
      if (this.currentRow1 == null) {
        this.errordialogVisible2 = true;
        document.documentElement.style.overflow = "hidden";
      } else {
        this.deletedialogVisible1 = true;
        document.documentElement.style.overflow = "hidden";
      }
    },
    deleteClose1() {
      this.deletedialogVisible1 = false;
      document.documentElement.style.overflow = "auto";
    },
    deletesend1() {
      this.deletedis1 = true;
      axios
        .post(this.url + "/workrecord/deledata", {
          id: this.currentRow1.id
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.deletedis1 = false;
            this.deletedialogVisible1 = false;
            document.documentElement.style.overflow = "auto";
            this.currentPage2 = 1;
            axios
              .post(this.url + "/workrecord/getentrydata", {
                username: this.username,
                time: this.date,
                pageNum: this.currentPage2,
                pageSize: this.pagesize2
              })
              .then(res => {
                this.unlogin(res.data.code);
                if (res.data.code == 200) {
                  this.tableData2 = res.data.data.list;
                  this.totalcount2 = res.data.data.total;
                }
              });
          }
        });
    },
    handleClose1() {
      this.errordialogVisible1 = false;
      document.documentElement.style.overflow = "auto";
    },
    entryadd() {
      this.addShow = !this.addShow;
      this.secondtitle = "新增入职情况";
      this.secondshow = true;
      this.type = 3;
    },
    entryedit() {
      if (this.currentRow1 == null) {
        this.errordialogVisible2 = true;
        document.documentElement.style.overflow = "hidden";
      } else {
        this.addShow = !this.addShow;
        this.secondtitle = "修改入职情况";
        this.secondshow = true;
        this.type = 4;
      }
    },
    handleClose2() {
      this.errordialogVisible2 = false;
      document.documentElement.style.overflow = "auto";
    },
    //隐藏新增需求
    hideShow() {
      this.addShow = !this.addShow;
      this.secondshow = false;
      this.secondtitle = "";
      this.type = null;
    },
    test(date) {
      this.currentPage = 1;
      this.currentPage1 = 1;
      this.currentPage2 = 1;
      var date = moment(date).format("YYYY-MM-DD");
      axios
        .post(this.url + "/workrecord/checktime", {
          time: date
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.date = date;
            this.selectdownloadinfo();
            this.selectwebsite();
            // this.selectcompletion();
            this.selectuploadrecord();
            this.selectdownloadresume();
            this.getReamrk();
            this.getinterviewdata();
            this.getentrydata();
            if (this.date < moment(new Date()).format("YYYY-MM-DD")) {
              this.btndis = false;
            } else {
              this.btndis = true;
            }
          }
          if (res.data.code == -300) {
            this.data1 = this.date;
            this.errordialogVisible = true;
            document.documentElement.style.overflow = "hidden";
          }
        });
    },
    //柱状图
    // drawColumn() {
    //   Highcharts.chart("container", {
    //     chart: {
    //       type: "column"
    //     },
    //     title: {
    //       text: ""
    //     },
    //     subtitle: {
    //       text: ""
    //     },
    //     xAxis: {
    //       categories: ["主做职位", "辅做职位", "未负责职位"],
    //       crosshair: true
    //     },
    //     yAxis: {
    //       min: 0,
    //       title: {
    //         text: ""
    //       }
    //     },
    //     legend: {
    //       align: "center",
    //       verticalAlign: "bottom",
    //       x: 0,
    //       y: 0
    //     },
    //     tooltip: {
    //       // head + 每个 point + footer 拼接成完整的 table
    //       headerFormat:
    //         '<span style="font-size:10px">{point.key}</span><table>',
    //       pointFormat:
    //         '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
    //         '<td style="padding:0"><b>{point.y}个</b></td></tr>',
    //       footerFormat: "</table>",
    //       shared: true,
    //       useHTML: true
    //     },
    //     plotOptions: {
    //       column: {
    //         borderWidth: 0
    //       }
    //     },
    //     series: [
    //       {
    //         name: "要求推送简历数量",
    //         data: [
    //           this.completionlist.planNum,
    //           this.completionlist.supPlanNum,
    //           this.completionlist.surplus
    //         ],
    //         color: "#1e88e4"
    //       },
    //       {
    //         name: "实际推送简历数量",
    //         data: [
    //           this.completionlist.finishNum,
    //           this.completionlist.supFinishNum
    //         ],
    //         color: "#24c8dc"
    //       }
    //     ]
    //   });
    // },
    //水波图
    // liquidFill() {
    //   var liquid = this.$echarts.init(document.getElementById("chart"));
    //   var vm = this;
    //   liquid.setOption({
    //     title: {
    //       text: "今日任务未完成，不可提交!",
    //       textStyle: {
    //         color: "#f27171",
    //         fontFamily: "Microsoft YaHei",
    //         align: "center",
    //         verticalAlign: "middle"
    //       },
    //       bottom: "30px",
    //       left: "center"
    //     },
    //     series: [
    //       {
    //         type: "liquidFill",
    //         data: [vm.completionlist.percentage, vm.completionlist.percentage],
    //         outline: {
    //           borderDistance: 0,
    //           itemStyle: {
    //             borderWidth: 0
    //           }
    //         },
    //         backgroundStyle: {
    //           color: "#fff",
    //           borderWidth: "2",
    //           borderColor: "#5fb3f7",
    //           itemStyle: {
    //             shadowBlur: 100,
    //             shadowColor: "#f60",
    //             opacity: 1
    //           }
    //         },
    //         itemStyle: {
    //           opacity: 0.5,
    //           shadowBlur: 10
    //         },
    //         emphasis: {
    //           itemStyle: {
    //             opacity: 1
    //           }
    //         },
    //         color: ["#5fb3f7"],
    //         shape: "circle",
    //         center: ["50%", "40%"],
    //         radius: "60%",
    //         amplitude: 3,
    //         waveLength: "50%",
    //         phase: 0,
    //         period: (value, index) => {
    //           return index * 2000;
    //         },
    //         direction: "left",
    //         waveAnimation: true,
    //         animationEasing: "linear",
    //         animationEasingUpdate: "quarticInOut",
    //         animationDuration: 3000,
    //         animationDurationUpdate: 300
    //       }
    //     ]
    //   });
    // },
    //查询下载状况
    selectdownloadinfo() {
      axios
        .post(this.url + "/workrecord/selectdownloadinfo", {
          time: this.date
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.activities = res.data.data;
          }
        });
    },
    //完成情况
    // selectcompletion() {
    //   axios
    //     .post(this.url + "/workrecord/selectcompletion", {
    //       time: this.date
    //     })
    //     .then(res => {
    //       this.unlogin(res.data.code);
    //       if (res.data.code == 200) {
    //         this.completionlist = res.data.data;
    //         if (this.completionlist.percentage !== 0) {
    //           this.completionlist.percentage =
    //             this.completionlist.percentage / 100;
    //           if (this.completionlist.percentage !== 1) {
    //             this.$nextTick(() => {
    //               this.liquidFill();
    //             });
    //           }
    //         }
    //         if (this.completionlist.percentage == 0) {
    //           this.$nextTick(() => {
    //             this.liquidFill();
    //           });
    //         }
    //         this.$nextTick(() => {
    //           this.drawColumn();
    //         });
    //       }
    //     });
    // },
    //上传记录
    selectuploadrecord() {
      axios
        .post(this.url + "/workrecord/selectuploadrecord", {
          time: this.date,
          pageNum: this.currentPage,
          pageSize: this.pagesize
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData = res.data.data.list;
            this.totalcount = res.data.data.total;
          }
        });
    },
    //下载情况
    selectdownloadresume() {
      axios
        .post(this.url + "/workrecord/selectdownloadresume", {
          time: this.date
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.data = res.data.data;
          }
        });
    },
    handleSizeChange(val) {
      this.pagesize = val;
      this.selectuploadrecord();
    },
    pagehandleCurrentChange(val) {
      this.currentPage = val;
      this.selectuploadrecord();
    },
    //预约面试情况表格
    getinterviewdata() {
      axios
        .post(this.url + "/workrecord/getinterviewdata", {
          username: this.username,
          time: this.date,
          pageNum: this.currentPage1,
          pageSize: this.pagesize1
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData1 = res.data.data.list;
            this.totalcount1 = res.data.data.total;
          }
        });
    },
    initMsg(row) {
      this.addShow = false;
      this.secondshow = false;
      this.type = null;
      this.currentRow = null;
      this.currentPage1 = 1;
      axios
        .post(this.url + "/workrecord/getinterviewdata", {
          username: this.username,
          time: this.date,
          pageNum: this.currentPage1,
          pageSize: this.pagesize1
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData1 = res.data.data.list;
            this.totalcount1 = res.data.data.total;
          }
        });
    },
    initMsg1(row) {
      this.addShow = false;
      this.secondshow = false;
      this.currentRow = null;
      this.type = null;
      axios
        .post(this.url + "/workrecord/getinterviewdata", {
          username: this.username,
          time: this.date,
          pageNum: this.currentPage1,
          pageSize: this.pagesize1
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData1 = res.data.data.list;
            this.totalcount1 = res.data.data.total;
          }
        });
    },
    initMsg2(row) {
      this.addShow = false;
      this.secondshow = false;
      this.type = null;
      this.currentRow1 = null;
      this.currentPage2 = 1;
      axios
        .post(this.url + "/workrecord/getentrydata", {
          username: this.username,
          time: this.date,
          pageNum: this.currentPage1,
          pageSize: this.pagesize1
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData2 = res.data.data.list;
            this.totalcount2 = res.data.data.total;
          }
        });
    },
    initMsg3(row) {
      this.addShow = false;
      this.secondshow = false;
      this.currentRow1 = null;
      this.type = null;
      axios
        .post(this.url + "/workrecord/getentrydata", {
          username: this.username,
          time: this.date,
          pageNum: this.currentPage1,
          pageSize: this.pagesize1
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData2 = res.data.data.list;
            this.totalcount2 = res.data.data.total;
          }
        });
    },
    // 入职情况表格
    getentrydata() {
      axios
        .post(this.url + "/workrecord/getentrydata", {
          username: this.username,
          time: this.date,
          pageNum: this.currentPage2,
          pageSize: this.pagesize2
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.tableData2 = res.data.data.list;
            this.totalcount2 = res.data.data.total;
          }
        });
    },
    handleSizeChange1(val) {
      this.pagesize1 = val;
      this.getinterviewdata();
    },
    pagehandleCurrentChange1(val) {
      this.currentPage1 = val;
      this.getinterviewdata();
    },
    handleSizeChange2(val) {
      this.pagesize2 = val;
      this.getentrydata();
    },
    pagehandleCurrentChange2(val) {
      this.currentPage2 = val;
      this.getentrydata();
    },
    //备注
    getReamrk() {
      axios
        .post(this.url + "/workrecord/seltadaywork", {
          time: this.date,
          username: this.username
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.remarks = res.data.data.content;
            this.id = res.data.data.id;
          }
        });
    },
    updatetodaywork() {
      this.savedis = true;
      axios
        .post(this.url + "/workrecord/updatadaywork", {
          id: this.id,
          content: this.remarks
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.getReamrk();
            this.savedis = false;
          }
        });
    },
    //新增下载情况
    addClick() {
      this.addform.data = [{ websiteName: "", downloadNum: "", callNum: "" }];
      this.num = 1;
      this.adddis = false;
      this.dialogVisible = true;
      document.documentElement.style.overflow = "hidden";
    },
    //选择招聘网站
    selectwebsite() {
      this.websitelist = [];
      axios.post(this.url + "/workrecord/selectwebsite").then(res => {
        this.unlogin(res.data.code);
        if (res.data.code == 200) {
          this.websitelist = res.data.data;
        }
      });
    },
    //添加表单数据
    add() {
      this.num++;
      if (this.num > this.websitelist.length) {
        this.$notify.info({
          title: "消息",
          message:
            "招聘网站地址最多有" + this.websitelist.length + "个，不可再次添加",
          duration: 10000
        });
      }
      if (this.addform.data.length < this.websitelist.length) {
        this.addform.data.push({
          websiteName: "",
          downloadNum: "",
          callNum: ""
        });
      }
    },
    //删除表单数据
    delete1(index) {
      this.num = this.addform.data.length;
      this.num--;
      this.addform.data.splice(index, 1);
    },
    //对已选择的招聘网站进行再次选择时进行提醒，并将提交按钮置灰
    selweb(index, value) {
      for (var i = 0; i < this.addform.data.length; i++) {
        if (i !== index) {
          if (value == this.addform.data[i].websiteName) {
            this.open(value);
            this.adddis = true;
            this.repeaterror = true;
            break;
          } else {
            if (this.repeaterror) {
              this.adddis = false;
              this.close();
              this.repeaterror = !this.repeaterror;
            }
          }
        }
      }
      if (this.repeaterror) {
        this.addform.data[index].websiteName = "";
      }
    },
    open(value) {
      this.repeat1 = this.$notify.info({
        title: "消息",
        message: value + "已被选择,请重新选择招聘网站地址!",
        duration: 10000
      });
    },
    close() {
      this.repeat1.close();
    },
    //提交新增下载数据
    addConfirm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.adddis = true;
          axios
            .post(this.url + "/workrecord/updatedownloadinfo", {
              form: this.addform.data
            })
            .then(res => {
              this.unlogin(res.data.code);
              if (res.data.code == 200) {
                this.adddis = false;
                this.selectdownloadinfo();
                this.addform.data = [
                  { websiteName: "", downloadNum: "", callNum: "" }
                ];
                this.dialogVisible = false;
                document.documentElement.style.overflow = "auto";
                this.$refs.addform.resetFields();
                this.selectwebsite();
              }
            });
        }
      });
    },
    //关闭新增下载数据的弹出框
    dialogClose() {
      this.num = 1;
      this.selectwebsite();
      this.adddis = false;
      this.repeaterror = false;
      this.numerror = false;
      this.numerror1 = false;
      this.$refs.addform.resetFields();
      this.dialogVisible = false;
      document.documentElement.style.overflow = "auto";
      this.addform.data = [{ websiteName: "", downloadNum: "", callNum: "" }];
    },
    //登出功能
    logout() {
      axios.post(this.url + "/user/logout").then(res => {
        this.unlogin(res.data.code);
        if (res.data.code == 200) {
          tagsView.commit("changeLoginState", false);
          tagsView.dispatch("delAllViews");
          this.$router.push("/");
        }
      });
    },
    handleClose() {
      this.errordialogVisible = false;
      document.documentElement.style.overflow = "auto";
    },
    //判断简历下载数量与电话沟通数量的大小
    judge(index, value) {
      if (this.addform.data[index].downloadNum !== "") {
        if (Number(this.addform.data[index].downloadNum) < Number(value)) {
          this.open1();
          this.numerror = true;
          this.adddis = true;
        } else {
          if (this.numerror) {
            this.close1();
            this.numerror = false;
            this.adddis = false;
          }
        }
      }
    },
    open1() {
      this.num1 = this.$notify.info({
        title: "消息",
        message: "电话沟通数量须小于简历下载数量",
        duration: 0
      });
    },
    close1() {
      this.num1.close();
    },
    //判断电话沟通数量与简历下载数量的大小
    judge1(index, value) {
      if (this.addform.data[index].callNum !== "") {
        if (Number(this.addform.data[index].callNum) > Number(value)) {
          this.open2();
          this.adddis = true;
          this.numerror1 = true;
        } else {
          if (this.numerror1) {
            this.numerror1 = !this.numerror1;
            this.close2();
            this.adddis = false;
          }
        }
      }
    },
    open2() {
      this.num2 = this.$notify.info({
        title: "消息",
        message: "简历下载数量须大于电话沟通数量",
        duration: 0
      });
    },
    close2() {
      this.num2.close();
    }
  },
  components: {
    interviewAdd,
    interviewEdit,
    entryAdd,
    entryEdit
  },
  watch: {
    data1: function(val) {
      this.test(moment(val).format("YYYY-MM-DD"));
    }
  }
};
</script>

<style scoped>
.title {
  background-color: #fff;
  height: 40px;
  line-height: 40px;
  font-size: 14px;
  padding-left: 20px;
  margin-top: 6px;
  margin-bottom: 6px;
}

.posttable {
  min-height: 700px;
  background-color: #fff;
}

.top {
  background-color: #fff;
  padding-top: 16px;
  padding-left: 18px;
  padding-bottom: 16px;
  padding-right: 18px;
}

.center {
  margin-top: 6px;
  padding: 14px 18px;
  background-color: #fff;
}

.bottom {
  margin-top: 6px;
  padding: 14px 18px;
  background-color: #fff;
}

.add {
  width: 65px;
  height: 28px;
  opacity: 0.86;
  color: #fff;
  background: linear-gradient(to bottom, #5696f8 0%, #143dea 100%);
  padding: 7px 15px !important;
}

.add:hover {
  color: #fff !important;
}

.add:focus {
  color: #fff !important;
}

.timeLine {
  margin-left: 10px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}

.bigBox {
  width: 86px;
  height: 86px;
  border-radius: 43px;
  position: relative;
  background-color: #d9ebff;
}

.inside {
  width: 56px;
  height: 56px;
  text-align: center;
  line-height: 56px;
  border-radius: 28px;
  background-color: #4da2ff;
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -28px;
  margin-top: -28px;
  color: #fff;
  font-weight: bold;
  font-size: 26px;
}

.totalText {
  margin-top: 20px;
  font-size: 16px;
  color: #747474;
  font-weight: 600;
  margin-left: -4px;
}

.pager {
  width: 100%;
  overflow: hidden;
  position: relative;
  margin-top: 10px;
  margin-bottom: 10px;
}

.el-pagination {
  margin-left: 50%;
  transform: translateX(-50%);
}

.data {
  width: 295px;
  height: 100px;
  border: 2px solid #ececec;
  border-radius: 10px;
  padding-left: 16px;
  padding-bottom: 10px;
  margin-right: 30px;
  margin-bottom: 15px;
}

.textactive {
  color: #1099ff;
}
.edit {
  width: 65px;
  height: 28px;
  padding: 7px 15px !important;
  opacity: 0.86;
  color: #fff;
  background: linear-gradient(to bottom, #00cebf 0%, #009085 100%);
}

.delete {
  width: 65px;
  height: 28px;
  padding: 7px 15px !important;
  opacity: 0.86;
  color: #fff;
  background: linear-gradient(to bottom, #ff5461 0%, #ff545f 100%);
}
.save {
  margin-top: 8px;
  width: 150px;
  height: 40px;
  font-size: 16px;
  color: #fff;
  border-radius: 4px;
  margin-right: 43px;
  background: linear-gradient(to bottom, #5696f8 0%, #4e6ef5 100%);
}
@media screen and (min-width: 1200px) and (max-width: 1675px) {
  .secondbox {
    width: 74.83333%;
    margin-bottom: 20px;
  }

  .data:nth-child(4n) {
    margin-right: 0px;
  }
}

@media screen and (min-width: 1676px) and (max-width: 1900px) {
  .data:nth-child(5n) {
    margin-right: 0px;
  }

  .data:nth-child(5n) {
    margin-right: 0px;
  }
}

@media only screen and (min-width: 1920px) {
  .secondbox {
    width: 41.66667%;
    margin-right: 20px;
  }

  .data {
    width: 339px;
    margin-right: 33px;
  }

  .data:nth-child(5n) {
    margin-right: 0px;
  }
}
</style>
